function isnull(newValue)
{
    if(newValue==""||newValue==null)
    {
        return true;
    }
}
function isAccountUnique(newAccount)
{
    return false;
}
function checkIdNoErr(newIdNo)
{
    if(!/^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(newIdNo))
    {
        return true;
    }
}
function checkEmailErr(newEmail){
    if(!/^\w+@[a-z0-9]+(\.[a-z]+){1,3}$/.test(newEmail))
    {
        return true;
    }
}
function checkPhoneErr(newPhone)
{
    if(!/^1[3|4|5|8][0-9]\d{4,8}$/.test(newPhone))
    {
        return true;
    }
}
function submitForm()
{
    //var username=document.getElementById("username").value;
    //var account=document.getElementById("account").value;
    //var password=document.getElementById("password").value;
    //var mail=document.getElementById("mail").value;
    //var phone=document.getElementById("phone").value;
    //var id=document.getElementById("id").value;

    var username=$("#username").val();
    var account=$("#account").val();
    var password=$("#password").val();
    var mail=$("#mail").val();
    var phone=$("#phone").val();
    var id=$("#id").val();

    console.log(username);
    console.log(account);
    console.log(password);
    console.log(mail);
    console.log(phone);
    console.log(id);

    var isRegister=true;
    var arrStr="";
    if(isnull(username))
    {
        isRegister=false;
        errStr="用户名不能为空";
    }
    else if(isnull(account))
    {
        isRegister=false;
        errStr="账户名不能为空";
    }
    else if(isAccountUnique(account))
    {
        isRegister=false;
        errStr="账户名已存在";
    }
    else if(isnull(password))
    {
        isRegister=false;
        errStr="密码不能为空";
    }
    else if(isnull(mail))
    {
        isRegister=false;
        errStr="邮箱不能为空";
    }
    else if(checkEmailErr(mail))
    {
        isRegister=false;
        errStr="邮箱格式有误";
    }
    else if(isnull(phone))
    {
        isRegister=false;
        errStr="手机号不能为空";
    }
    else if(checkPhoneErr(phone))
    {
        isRegister=false;
        errStr="手机号格式有误";
    }
    else if(isnull(id))
    {
        isRegister=false;
        errStr="身份证号不能为空";
    }
    else(checkIdNoErr(id))
    {
        isRegister=false;
        errStr="身份证号格式有误";
    }
    if(isRegister)
    {
        errStr="注册成功";
    }
    alert(errStr);
}
